<?php
include_once ('head.php');

?>
<div class="container">
	<div class="layui-card">
		<div class="layui-card-header">发信邮件设置</div>
		<div class="layui-card-body">
			<form class="layui-form layui-form-pane" action=""><input type="hidden" name="my" value="emailset">
				<div class="layui-form-item">
					<label class="layui-form-label" title="发信模式">发信模式</label>
					<div class="layui-input-block">
						<select name="mail_type" lay-filter="aihao">
							<option value="1">普通模式</option>
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" title="邮箱SMTP服务器">邮箱SMTP服务器</label>
					<div class="layui-input-block">
						<input type="text" name="mail_stmp" autocomplete="off" value="<?=$conf['mail_stmp']?>" placeholder="" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" title="邮箱SMTP端口">邮箱SMTP端口</label>
					<div class="layui-input-block">
						<input type="text" name="mail_port" autocomplete="off" value="<?=$conf['mail_port']?>" placeholder="" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" title="邮箱账号">邮箱账号</label>
					<div class="layui-input-block">
						<input type="text" name="mail_name" autocomplete="off" value="<?=$conf['mail_name']?>" placeholder="" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" title="邮箱密码">邮箱密码</label>
					<div class="layui-input-block">
						<input type="password" name="mail_pwd" autocomplete="off" value="<?=$conf['mail_pwd']?>" placeholder="" class="layui-input">
					</div>
				</div>
				<blockquote class="layui-elem-quote layui-quote-nm">
					<font color="#ff5722">如果为QQ邮箱需先开通SMTP，且要填写QQ邮箱独立密码。邮箱SMTP服务器可以百度一下，例如QQ邮箱的即为 smtp.qq.com。邮箱SMTP端口默认为25，SSL的端口是465。
					</font>
					<a href="http://www.qqzzz.net/wiki/mail_faq.txt" style="color: #1e9fff;" target="_blank">查看邮件发送失败的相关解决方法</a>
				</blockquote>
				
				<button type="button" class="layui-btn layui-btn-fluid" lay-filter="set" lay-submit>更 改</button>
			</form>
		</div>
	</div>
</div>
	<script src="../layui/layui.all.js"></script>
	<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
	<!--您的Layui代码start-->
	<script type="text/javascript">
		const {$,form,layer} = layui;
		form.on('submit(set)', function(setdata){
			var index = layer.load(1, {
				shade: [0.6, '#000']
			});
			$.ajax({
				type: "post",   
				url:  "Ajax.php", 
				data: setdata.field,
				dataType: "json",
				success: function (res) {
					layer.close(index);
					if(res.code==1){
						layer.msg(res.msg,{icon: 6});
						history.go(0);
					}else if(res.code==0){
						layer.msg(res.msg,{icon: 5});
					}
				},
				error: function (res) {
					layer.msg('请求失败',{icon: 5});
					layer.close(index);
				}   
			});
		})
	</script>
</body>
</html>

